package v1

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"next-vue-backend/model"
	"next-vue-backend/utils/errmsg"
)

func Upload (c *gin.Context) {
	file,fileHeader, _ := c.Request.FormFile("file")

	fileSize := fileHeader.Size
	url, code := model.UploadFile(file, fileSize)
	c.JSON(http.StatusOK,gin.H{
		"status":code,
		"message":errmsg.GetErrMsg(code),
		"data": url,
	})
}
